<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>regexp</title>
</head>
<body>
    <div id="box">
        <div class="cl1 get"></div>
        <div class="cl2 gett post"></div>
        <div class="cl3 post"></div>
        <div class="cl4"></div>
    </div>
    <script>
    /*regex=/\w{2}/g;
    console.log(" 883 3445566".match(regex));
    console.log(regex.exec(" 883 3445566"));
    console.log(typeof("  8833445566".search(regex)));*/


        function getClass(classname,dom){
            var ele=dom||document;
            var all=ele.getElementsByTagName("*");
            var arrN=[];
            var reg=new RegExp("\\b"+classname+"\\b","g");
            console.log(reg);
            for(var i=0;i<all.length;i++)
            {
                if(all[i].className.match(reg))
                {
                    arrN.push(all[i]);
                }
            }
            return arrN;
        }

        var box=document.getElementById("box");
        var cls=getClass("cl1 get");
        console.log(cls);

    </script>
</body>
</html>